const {contextBridge, ipcRenderer} = require('electron')

contextBridge.exposeInMainWorld('pageEvent', {
    // 告知主进程切换页面
    switchPage: (to, param = null) => ipcRenderer.send('switchPage', to, param),
    // crawler_detail页面获知爬虫根URL列表
    onRootUrl: (callback) => ipcRenderer.on('sendRootUrl', callback),
    onSendTaskDetail: (callback) => ipcRenderer.on('sendTaskDetail', callback),
    onSendAllCategories: (callback) => ipcRenderer.on('sendAllCategories', callback),
})

console.log("preload script loaded!")